package com.otherTest.designpattern.behavioralpattern.chainresponsibility;


import java.math.BigDecimal;
import java.util.Objects;

/**
 * @Description: 总经理
 * @author: conceit
 * @Date: 2018/9/1 16:01
 */
public class GeneralManagerHandler extends ChainResponsibilityHandler {

    private final static BigDecimal generalManagerPermission = new BigDecimal(20);

    @Override
    public void handlerRequest(BigDecimal leaveDay) {
        if (leaveDay.compareTo(generalManagerPermission) != 1) {
            System.out.println("总经理已经批准你的请假！");
        } else {
            //判断是否还有下一个责任链来处理
            if (Objects.nonNull(nextHandler)) {
                System.out.println("总经理没有权限，已经向上级汇报你的狼子野心了！！");
                this.nextHandler.handlerRequest(leaveDay);
            } else {
                System.out.println("已经到终点了哥们，你请假的天数太长了！");
            }
        }
    }
}
